<script type="text/javascript">
<!--
function addToFavorite(id, type) {
	data = {'target':id, 'type':type};
	$.getJSON('/account/add-favorite', data, function(r) {
		  alert(r.message);
	});
}
//-->
</script>
<div id="pagepro" class="w920">
	<div class="pic">
	
			
			
		<a href="javascript:showBig();"><img src="<?=$this->artwork->getPhotoWebAccessablePath('260x260');?>" /></a>
		<p>
			<?php if($this->artwork->knockdown_price <= 0){?>
			<a href="/account/add-order/artworkId/<?php echo $this->artwork->id;?>" title="Buy it Now"><span>Buy it Now</span></a>
			<?php }else{ echo "<a href='#'><span>Sold out</span></a>"; }?>
			<?php if ($this->currentUser) {?>
			<a href="javascript:addToFavorite(<?=$this->artwork->id?>, 'artwork');" title="Add Favorite"><span>Add Favorite</span></a>
			<?php }?>
			
		</p>
		
		
		
	</div>
	<div class="cs">
		<h2><?=$this->escape($this->artwork->name)?></h2>
		<dl>
			<dt>Fine art category</dt>
			<dd><?=$this->parentCategory->name?></dd>
		</dl>
		<dl>
			<dt>Medium</dt>
			<dd><?=$this->category->name?></dd>
		</dl>
		<dl>
			<dt>Sizes</dt>
			<dd><?php echo $this->artwork->inch_size ." / ". $this->artwork->size;?></dd>
		</dl>
		<dl>
			<dt>Date of creation</dt>
			<dd><?=substr($this->artwork->date_of_creation, 0, 4);?></dd>
		</dl>
		<?php if ($this->artwork->subject) {
			$subjectObjs = $this->artwork->getSubjectsObj();
			foreach ($subjectObjs as $subjectObj) {
				$subjectNames[] = trim($subjectObj->name);
			}
			$subject = implode(', ', $subjectNames);
		?>
		<dl>
			<dt>Subject</dt>
			<dd><?=$subject?></dd>
		</dl>
		<?php } // endif?>
		<?php if ($this->artwork->style) {
			$styleObjs = $this->artwork->getStylesObj();
			foreach ($styleObjs as $styleObj) {
				$styles[] = trim($styleObj->name);
			}
			$style = implode(', ', $styles);
		?>
		<dl>
			<dt>Style</dt>
			<dd><?=$style?></dd>
		</dl>
		<?php } // endif?>
		<script type="text/javascript">
		function changeCurrency(currency) {
			var EUR = <?php echo $this->artwork->uro_price ? $this->artwork->uro_price : 0?>;
			var USD = <?php echo $this->artwork->usd_price ? $this->artwork->usd_price : 0?>;
			var RMB = <?php echo $this->artwork->rmb_price ? $this->artwork->rmb_price : 0?>;
			p = $('#price');
			c = $('#currency');
			if (currency=='USD') {
				p.html(USD);
				c.html('USD');
			} else if (currency=='EUR') {
				p.html(EUR);
				c.html('EUR');
			} else if (currency=='RMB') {
				p.html(RMB);
				c.html('RMB');
			}
		}
		</script>
		<dl>
			<dt>Price</dt>
			<dd><span id="price"><?=$this->artwork->usd_price?></span> <span id="currency">USD</span>
				<p>
					<a href="javascript:changeCurrency('EUR');"><span>EUR</span></a>
					<a href="javascript:changeCurrency('RMB');"><span>RMB</span></a>
					<a href="javascript:changeCurrency('USD');"><span>USD</span></a>
				</p>
			</dd>
		</dl>
		<dl>
			<dt>Country</dt>
			<dd>CHINA</dd>
		</dl>
		<dl>
			<dt>Auth certificate</dt>
			<dd>Yes</dd>
		</dl>
		
		<dl>
			<dt>Share it</dt>
			<dd>
			<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
			
			<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like layout="button_count" width="100" font="arial"></fb:like>
		
		</dd>
		</dl>
		<br>
		
		 
		<p><?=$this->artwork->intro?></p>
	</div>
</div>

<div id="content" class="w920">
	<div class="conleft" style="border-right:1px solid #bcbec0;padding-right:0;width:720px;">
		<div class="pagecontext">
			<h2>RESUME OF ARTIST:</h2>
			<div id="artistresume" style="height:160px;overflow:hidden;">
				<p>
				<br /><a href="/artists/show?id=<?=$this->artist->id?>"><b><u><?=$this->artist->name?></u></b></a><br />
				<b style="font-weight:bold;color:white;">Education</b><br />
				<?=$this->artist->education_background?><br />
				<b style="font-weight:bold;color:white;">Solo Exhibition</b><br />
				<?=$this->artist->solo_exh?><br />
				<b style="font-weight:bold;color:white;">Group exhibition</b><br /> 
				<?=$this->artist->group_exh?>                   
				</p>
			</div>
		<script type="text/javascript">
		function showMore() {
			$('#artistresume').css('height', '');
		}
		</script>
		<p class="more"><a href="javascript:showMore();">+More</a></p>
		</div>
		<div class="pagework">
			<h2>COMPARABLE WORKS</h2>
			<ul>
			<?php foreach ($this->comparableWorks as $work) {?>
				<li><a href="/artwork/show?id=<?=$work->id?>"><img src="<?=$work->getPhotoWebAccessablePath('130x130')?>" alt="<?=$this->escape($work->name)?>" /></a></li>
			<?php }?>
			</ul>
		</div>
		<div class="pagecomments">
			<h2>COMMENTS</h2>
			<div class="say">
				<ul><?php 
				if ($this->comments){
					foreach ($this->comments as $comment){
						$customer = $comment->getCustomer();
						//Zend_Debug::dump($customer);
						$coStr = "<li><b>$customer->name says:</b> $comment->content";
						if ($this->admin || $this->currentCustomer->id == $comment->customer){
							$coStr .= "&nbsp;&nbsp;&nbsp;<a href='/artwork/delete-comment/id/$comment->id'>DELETE</a>";
						}
						$coStr .= "</li>";
						echo $coStr;
					}
				}
				
				?>
				</ul>
			</div>
			<?php echo $this->commentForm;?>
		</div>
	</div>
	
	<div id="dialog-full-size" style="display: none; text-align:center;" title="<?=$this->artwork->name;?>">
	<img src="<?=$this->artwork->getPhotoWebAccessablePath("700x700");?>" />
	</div>
	<script type="text/javascript">
		function showBig() {
			$("#dialog-full-size").dialog({
				autoOpen: false,
				width: 850,
				modal: true
				
			});

			$('#dialog-full-size').dialog('open');
		}
	</script>
	
	<?php echo $this->render('global/right_ad.phtml')?>
</div>
